<?php

namespace Home\Service;

/**
 * 升级篇 Service
 *
 * @author 李静波
 */
class UpgradationService {

	public function allExercise($level) {
		if ($level == 1) {
			
			$result = array();
			
			$totalCount = 42;
			
			for($i = 0; $i < $totalCount; $i ++) {
				$index = $i + 1;
				
				$item = array(
						"index" => $index,
						"title" => "第{$index}题"
				);
				
				$result[] = $item;
			}
			
			return $result;
		} else {
			return array();
		}
	}

	public function getExerciseFileName($level, $index) {
		$name = str_pad($index, 2, "0", STR_PAD_LEFT);
		
		return "{$level}{$name}.SGF";
	}
}
